package com.yym.cloudweb.crawl.util;

import org.jsoup.nodes.Element;
import org.seimicrawler.xpath.JXDocument;

import java.util.List;

public class CrawlUtil {

    public static Object getValByXpath(Element element, String xpath){
        JXDocument eleJxDocument = JXDocument.create(element.toString());
        return eleJxDocument.selOne(xpath);
    }

    public static Object getValByXpath(String html, String xpath){
        JXDocument eleJxDocument = JXDocument.create(html);
        return eleJxDocument.selOne(xpath);
    }

    public static List<Object> getElements(String html,String xpath){
        JXDocument jxDocument = JXDocument.create(html);
        return jxDocument.sel(xpath);
    }

}
